
// 1. 导入 vue-router 包
import VueRouter from 'vue-router'

//导入子组件 HomeContainer MemberContainer SearchContainer ShopcarContainer Newslist Newsinfo Photolist Photoinfo Goodslist Goodsinfo Goodsdesc Goodscomment组件
import HomeContainer from './components/tabbar/HomeContainer.vue'
import MemberContainer from './components/tabbar/MemberContainer.vue'
import ShopcarContainer from './components/tabbar/ShopcarContainer.vue'
import SearchContainer from './components/tabbar/SearchContainer.vue'
import Newslist from './components/news/Newslist.vue'
import Newsinfo from './components/news/Newsinfo.vue'
import Photolist from './components/photos/Photolist.vue'
import Photoinfo from './components/photos/Photoinfo.vue'
import Goodslist from './components/goods/Goodslist.vue'
import Goodsinfo from './components/goods/Goodsinfo.vue'
import Goodsdesc from './components/goods/Goodsdesc.vue'
import Goodscomment from './components/goods/Goodscomment.vue'

// 3. 创建路由对象
var router = new VueRouter({
    routes: [ // 配置路由规则
       {path:'/',redirect:'home'},        
       {path:'/home',component:HomeContainer},
       {path:'/member',component:MemberContainer},
       {path:'/shopcar',component:ShopcarContainer},
       {path:'/search',component:SearchContainer},
       {path:'/home/newslist',component:Newslist},
       {path:'/home/newsinfo/:id',component:Newsinfo},//:id 传递数据
       {path:'/home/photolist',component:Photolist},
       {path:'/home/photoinfo/:id',component:Photoinfo},
       {path:'/home/goodslist',component:Goodslist},
       {path:'/home/goodsinfo/:id',component:Goodsinfo,name:'goodsinfo'},
       {path:'/home/goodsdesc/:id',component:Goodsdesc,name:'goodsdesc'},
       {path:'/home/goodscomment/:id',component:Goodscomment,name:'goodscomment'},
    ],
    linkActiveClass:'mui-active'// 覆盖默认的路由高亮的类，默认的类叫做 router-link-active
})

//把路由对象暴露出去
export default router